package cn.com.generaldata.os.service.indicator_evaluation.prosperity_analysis;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.Validate;
import org.nutz.dao.sql.Criteria;

import cn.com.generaldata.jsme_indicator_system.entity.IndicatorEvaluation;
import cn.com.generaldata.os.service.indicator_constant.ProvinceIndicatorConstant;
import cn.com.generaldata.os.service.indicator_evaluation.IndicatorEvaluationCalculateService;
import cn.com.generaldata.os.util.BeanMapper;
import cn.com.generaldata.os.vo.IndicatorAccountVO;

/**
 * 可直接计算增长率评估指标计算类.
 */
public class DirectCalculationIncreateCalculateService extends IndicatorEvaluationCalculateService {

	@Override
	protected Double calculate(IndicatorEvaluation indicator, IndicatorAccountVO indicatorAccountVO) {
		Double salePriceValue = getInputOrAccountingIndicatorValue(indicatorAccountVO, indicatorAccountVO.getYear(), indicator.getReference());
		Validate.isTrue(salePriceValue != null);
		Double lastValue = getInputOrAccountingIndicatorValue(indicatorAccountVO, indicatorAccountVO.getYear()-1, indicator.getReference());
		Validate.isTrue(lastValue != null);
		return salePriceValue/lastValue-1;
	}
	
}
